import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';
import 'package:flutter_swiper/flutter_swiper.dart';
import '../../widget/my_image.dart';
import '../../widget/product_content_page_indicator.dart';

class ProductAppBar extends StatefulWidget {
  ProductAppBar({this.sliderImage});
  final List sliderImage;
  @override
  _ProductAppBarState createState() => _ProductAppBarState();
}

class _ProductAppBarState extends State<ProductAppBar> {
  @override
  Widget build(BuildContext context) {
    return Stack(
      children: [
        AspectRatio(
            aspectRatio: 1,
            child:Swiper(
              itemBuilder: (BuildContext context, int index) {
                return MyImage(
                    imgSrc:widget.sliderImage[index]);
              },
//              indicatorLayout: PageIndicatorLayout.COLOR,
              autoplay: false,
              itemCount: widget.sliderImage.length,
              pagination:  SwiperPagination(builder:ProductContentPageIndicator(
                  color:Colors.green
              ),alignment: Alignment.bottomRight),
//              control: new SwiperControl(),
            )
        ),Positioned(
          top:30,
          left:15.w,
          child: BackButton(color: Colors.white,),
        )
      ],
    );
  }
}
